#pragma once
#include <iostream>
#include <list>
#include <map>
#include <vector>
#include <unordered_map>
#include "PLF.h"
using namespace std;

struct Min_Max_Value {
	float minValue;
	float maxValue;
	Min_Max_Value() {}
	Min_Max_Value(float minValue, float maxValue) : minValue(minValue), maxValue(maxValue) {};
};

struct RoadNode {

	int nodeVal; 
	unordered_map<int, float> roadOutEdge; 
	unordered_map<int, PLF> plf;
	unordered_map<int, Min_Max_Value> min_max;
	float x, y;

	RoadNode(int val) {
		nodeVal = val;
	}

	RoadNode(int val, float x, float y) {
		nodeVal = val;
		this->x = x;
		this->y = y;
	}

	void addEdge(int neighbourNodeVal, float avgTravelTime) {
		roadOutEdge.emplace(map<int, float>::value_type(neighbourNodeVal, avgTravelTime));
	}

	void addEdge(int neighbourNodeVal) {
		roadOutEdge.emplace(map<int, float>::value_type(neighbourNodeVal, 0));
	}

	void addPLF(int neighbourNodeVal, std::shared_ptr<std::vector<Segment>>& f) {
		plf[neighbourNodeVal].f = f;
	}

	void addMin_Max(int neighbourNodeVal, Min_Max_Value min_max_value) {
		min_max.emplace(map<int, Min_Max_Value>::value_type(neighbourNodeVal, min_max_value));
	}

	void print_toString() {
		unordered_map<int, float>::iterator  iter;
		for (iter = roadOutEdge.begin(); iter != roadOutEdge.end(); iter++) {
			cout << iter->first << "   " << iter->second << endl;
		}
	}

};